﻿using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace DataEntities
{
    [Table(Name = "dbo.WeiZhangInfo")]
    public partial class WeiZhangInfo : Entity
    {

        private int _iWZDId;

        private int _iCarid;

        private int _iKeHuId;

        private int _iCZDId;

        private string _sWZAddr;

        private string _sWZDetail;

        private double _dWZJE;

        private DateTime _tWZDate;

        private bool _bWZZF;

        private EntityRef<CarInfo> _CarInfo;

        private EntityRef<ChuZuInfo> _ChuZuInfo;

        private EntityRef<KeHuInfo> _KeHuInfo;

        public WeiZhangInfo()
        {
            this._CarInfo = default(EntityRef<CarInfo>);
            this._ChuZuInfo = default(EntityRef<ChuZuInfo>);
            this._KeHuInfo = default(EntityRef<KeHuInfo>);
        }

        [Column(Storage = "_iWZDId", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int iWZDId
        {
            get
            {
                return this._iWZDId;
            }
            set
            {
                if ((this._iWZDId != value))
                {
                    this.SendPropertyChanging("iWZDId");
                    this._iWZDId = value;
                    this.SendPropertyChanged("iWZDId",value);
                }
            }
        }

        [Column(Storage = "_iCarid", DbType = "Int")]
        public int iCarid
        {
            get
            {
                return this._iCarid;
            }
            set
            {
                if ((this._iCarid != value))
                {
                    if (this._CarInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iCarid");
                    this._iCarid = value;
                    this.SendPropertyChanged("iCarid",value);
                }
            }
        }

        [Column(Storage = "_iKeHuId", DbType = "Int")]
        public int iKeHuId
        {
            get
            {
                return this._iKeHuId;
            }
            set
            {
                if ((this._iKeHuId != value))
                {
                    if (this._KeHuInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iKeHuId");
                    this._iKeHuId = value;
                    this.SendPropertyChanged("iKeHuId",value);
                }
            }
        }

        [Column(Storage = "_iCZDId", DbType = "Int")]
        public int iCZDId
        {
            get
            {
                return this._iCZDId;
            }
            set
            {
                if ((this._iCZDId != value))
                {
                    if (this._ChuZuInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iCZDId");
                    this._iCZDId = value;
                    this.SendPropertyChanged("iCZDId",value);
                }
            }
        }

        [Column(Storage = "_sWZAddr", DbType = "VarChar(30)")]
        public string sWZAddr
        {
            get
            {
                return this._sWZAddr;
            }
            set
            {
                if ((this._sWZAddr != value))
                {
                    this.SendPropertyChanging("sWZAddr");
                    this._sWZAddr = value;
                    this.SendPropertyChanged("sWZAddr",value);
                }
            }
        }

        [Column(Storage = "_sWZDetail", DbType = "VarChar(100)")]
        public string sWZDetail
        {
            get
            {
                return this._sWZDetail;
            }
            set
            {
                if ((this._sWZDetail != value))
                {
                    this.SendPropertyChanging("sWZDetail");
                    this._sWZDetail = value;
                    this.SendPropertyChanged("sWZDetail",value);
                }
            }
        }

        [Column(Storage = "_dWZJE", DbType = "Float")]
        public double dWZJE
        {
            get
            {
                return this._dWZJE;
            }
            set
            {
                if ((this._dWZJE != value))
                {
                    this.SendPropertyChanging("dWZJE");
                    this._dWZJE = value;
                    this.SendPropertyChanged("dWZJE",value);
                }
            }
        }

        [Column(Storage = "_tWZDate", DbType = "DateTime")]
        public DateTime tWZDate
        {
            get
            {
                return this._tWZDate;
            }
            set
            {
                if ((this._tWZDate != value))
                {
                    this.SendPropertyChanging("tWZDate");
                    this._tWZDate = value;
                    this.SendPropertyChanged("tWZDate",value);
                }
            }
        }

        [Column(Storage = "_bWZZF", DbType = "Bit")]
        public bool bWZZF
        {
            get
            {
                return this._bWZZF;
            }
            set
            {
                if ((this._bWZZF != value))
                {
                    this.SendPropertyChanging("bWZZF");
                    this._bWZZF = value;
                    this.SendPropertyChanged("bWZZF",value);
                }
            }
        }

        [Association(Name = "CarInfo_WeiZhangInfo", Storage = "_CarInfo", ThisKey = "iCarid", OtherKey = "iCarid", IsForeignKey = true)]
        public CarInfo CarInfo
        {
            get
            {
                return this._CarInfo.Entity;
            }
            set
            {
                CarInfo previousValue = this._CarInfo.Entity;
                if (((previousValue != value)
                            || (this._CarInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("CarInfo");
                    if ((previousValue != null))
                    {
                        this._CarInfo.Entity = null;
                        previousValue.WeiZhangInfo.Remove(this);
                    }
                    this._CarInfo.Entity = value;
                    if ((value != null))
                    {
                        value.WeiZhangInfo.Add(this);
                        this._iCarid = value.iCarid;
                    }
                    else
                    {
                        this._iCarid = default(int);
                    }
                    this.SendPropertyChanged("CarInfo",value);
                }
            }
        }

        [Association(Name = "ChuZuInfo_WeiZhangInfo", Storage = "_ChuZuInfo", ThisKey = "iCZDId", OtherKey = "iCZDId", IsForeignKey = true)]
        public ChuZuInfo ChuZuInfo
        {
            get
            {
                return this._ChuZuInfo.Entity;
            }
            set
            {
                ChuZuInfo previousValue = this._ChuZuInfo.Entity;
                if (((previousValue != value)
                            || (this._ChuZuInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("ChuZuInfo");
                    if ((previousValue != null))
                    {
                        this._ChuZuInfo.Entity = null;
                        previousValue.WeiZhangInfo.Remove(this);
                    }
                    this._ChuZuInfo.Entity = value;
                    if ((value != null))
                    {
                        value.WeiZhangInfo.Add(this);
                        this._iCZDId = value.iCZDId;
                    }
                    else
                    {
                        this._iCZDId = default(int);
                    }
                    this.SendPropertyChanged("ChuZuInfo",value);
                }
            }
        }

        [Association(Name = "KeHuInfo_WeiZhangInfo", Storage = "_KeHuInfo", ThisKey = "iKeHuId", OtherKey = "iKeHuId", IsForeignKey = true)]
        public KeHuInfo KeHuInfo
        {
            get
            {
                return this._KeHuInfo.Entity;
            }
            set
            {
                KeHuInfo previousValue = this._KeHuInfo.Entity;
                if (((previousValue != value)
                            || (this._KeHuInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("KeHuInfo");
                    if ((previousValue != null))
                    {
                        this._KeHuInfo.Entity = null;
                        previousValue.WeiZhangInfo.Remove(this);
                    }
                    this._KeHuInfo.Entity = value;
                    if ((value != null))
                    {
                        value.WeiZhangInfo.Add(this);
                        this._iKeHuId = value.iKeHuId;
                    }
                    else
                    {
                        this._iKeHuId = default(int);
                    }
                    this.SendPropertyChanged("KeHuInfo",value);
                }
            }
        }
    }
}
